export default {
    unpdate_Collapse(state, payload) {

        state.isCollapse = payload
    },
    set_breadList(state, payload) {

        state.breadList = payload
    },
    update_default(state, palyload) {
        state.routerDefault = palyload
    },
    //添加历史路由
    add_history(state, palyload) {
        let { path, name, isNow } = palyload;
        let { history } = state
        const ishas = history.some(item => item.path == path)
        //除了当前其余改false  默认不激活
        history = history.map((item) => {
            item.path != path ? (item.isNow = false) : (item.isNow = true);
            return item;
        });
        if (!ishas) {
            history.push({ path, name, isNow })
        }
        state.history = [...history]
    },
    //删除历史路由
    remove_history(state, palyload) {
        console.log(palyload);
        let { index } = palyload;
        let { history } = state
        if (history[index].isNow) history[0].isNow = true;
        state.history.splice(index, 1)
    }
}